package com.bw.base.mvvm

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.databinding.DataBindingUtil
import androidx.databinding.ViewDataBinding
import androidx.lifecycle.ViewModelProvider

abstract class BaseActivity<VDB:ViewDataBinding,VM:BaseViewModel>:AppCompatActivity() {

    lateinit var binding:VDB
    lateinit var viewModel:VM

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        binding=DataBindingUtil.setContentView(this,getLayoutID())
        viewModel=ViewModelProvider(this).get(getviewmodel())
        initView()
        initData()
    }



    abstract fun initView()

    abstract fun initData()

    abstract fun getviewmodel(): Class<VM>

    abstract fun getLayoutID(): Int


}